﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>系统登录</title>

    <link href="../css/login.css" rel="stylesheet" />
    <link href="../css/demo.css" rel="stylesheet" />
    <script src="../Content/scripts/jquery-1.11.1.min.js"></script>
    <link href="../Content/scripts/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <!--<link rel="Shortcut icon" href="../images/favicon.ico" />-->
    <script src="../Content/scripts/plugins/cookie/jquery.cookie.js"></script>
    <link href="../Content/styles/learun-ui.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/dialog/dialog.js"></script>
    <script src="../Content/scripts/utils/learun-ui.js"></script>
    <script src="../Content/scripts/utils/learun-form.js"></script>
    <script src="../js/Validform_v5.3.2_min.js"></script>
    <style>
        .bgm {
            background: url(../images/loginbackground.jpg) no-repeat;
            width: 100%;
            height: 100%;
            background-size: 100% 100%;
            position: absolute;
            filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='loginbackground.jpg',sizingMethod='scale');
            ;
        }

        @media screen and (max-width:1020px) {
            .header {
                height: 0px;
                margin: 0px;
            }

            .banner {
                height: 450px;
            }

            .login-aside {
                top: 160px;
                left: 60%;
            }
        }



        @media screen and (min-width:1020px) and (max-width:1280px) {

            .header {
                height: 0px;
                margin: 0px;
            }

            .banner {
                height: 450px;
            }

            .login-aside {
                top: 160px;
                left: 70%;
            }
        }

        @media screen and (min-width:1281px) and (max-width:1440px) {
            .header {
                height: 0px;
                margin: 0px;
            }

            .banner {
                height: 600px;
            }

            .login-aside {
                top: 220px;
                left: 70%;
            }
        }

        @media screen and (min-width:1441px) and (max-width:1920px) {
            .header {
                height: 84px;
                margin: 20px auto;
            }

            .banner {
                height: 800px;
            }
        }
    </style>
    <script>

        $(function () {
            $(".i-text").focus(function () {

                $(this).addClass('h-light');

            });


            $(".i-text").focusout(function () {

                $(this).removeClass('h-light');

            });

            $("#username").focus(function () {

                var username = $(this).val();

                if (username == '输入账号') {

                    $(this).val('');

                }

            });

            $("#username").focusout(function () {

                var username = $(this).val();

                if (username == '') {

                    $(this).val('输入账号');

                }

            });

            $(".registerform").Validform({

                tiptype: function (msg, o, cssctl) {

                    var objtip = $(".error-box");

                    cssctl(objtip, o.type);

                    objtip.text(msg);
                },
                ajaxPost: true

            });

            $("#sky").animate({ opacity: 1.0 });

            //$("#flashdownload").click(function () {

            //    var Action = "DownFlash";
            //    postAndRedirect("../Login/EditPassword.ashx?Action=" + Action, { CurrentAgent: $.isbrowsername() });
            //}).hover(function () {
            //    $("#flashdownload").css("cursor", "pointer");
            //})
        });

        //登录
        function login() {

            var userid = $('#username').val().replace("'", "''");
            var psw = $('#password').val();

            $.ajax({
                url: "./Login.ashx",
                data: {
                    Action: "Login",
                    userid: userid,
                    psw: psw
                },
                async: true,
                type: "post",
                datatype: "json",
                success: function (data) {
                    Loading(false);
                    data = JSON.parse(data);
                    console.log(data.result);
                    if (data.result == "success") {
                        Loading(false);
                        dialogMsg(data.msg, 1);
                        location.href = "../AdminIndex.html";

                    }
                    else
                        dialogMsg(data.msg, -1);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    Loading(false);
                    dialogMsg(errorThrown, -1);
                },
                beforeSend: function () {
                    Loading(true, "正在登录中");
                },
                complete: function () {
                    Loading(false);
                }
            });

        }

        function postAndRedirect(url, postData) {
            //  Redirect to a URL, and POST some data to it.
            //  Taken from:
            //  http://stackoverflow.com/questions/8389646/send-post-data-on-redirect-with-javascript-jquery
            //
            var postFormStr = "<form method='POST' action='" + url + "'>\n";

            for (var key in postData) {
                if (postData.hasOwnProperty(key)) {
                    postFormStr += "<input type='hidden' name='" + key + "' value='" + postData[key] + "'></input>";
                }
            }

            postFormStr += "</form>";

            var formElement = $(postFormStr);

            $('body').append(formElement);
            $(formElement).submit();
        }

    </script>

</head>
<body>
    <div class="header">


    </div>

    <div class="banner">

        <div class="login-aside">

            <div id="o-box-up"></div>

            <div id="o-box-down" style="table-layout:fixed;">

                <form class="registerform">

                    <div class="fm-item">
                        <label for="logonId" class="form-label">系统登陆：</label>

                        <input type="text" value="输入账号" maxlength="100" id="username" class="i-text">
                        <div class="ui-form-explain"></div>

                    </div>

                    <div class="fm-item">
                        <label for="logonId" class="form-label">登陆密码：</label>

                        <input type="password" value="" maxlength="100" id="password" class="i-text">
                        <div class="ui-form-explain"></div>
                    </div>

                    <div class="fm-item">
                        <label for="logonId" class="form-label"></label>
                        <input type="submit" value="" tabindex="4" id="send-btn" class="btn-login" onclick="login()">
                        <div class="ui-form-explain"></div>
                    </div>
                </form>
            </div>
        </div>

        <div class="bgm">
            <!-- <ul>
                <li class="bgm"><a target="_blank"></a></li>

            </ul> -->

        </div>

        <div class="hd"><ul></ul></div>

    </div>

</body>


</html>
